package com.hbnu.array;

import java.util.Scanner;

public class DemoArray10 {
    //输入年月日，返回这是这一年的第多少天
    public static void main(String[] args) {
        int[] month_31 = new int[]{1,3,5,7,8,10,12};
        int[] month_30 = new int[]{4,6,9,11};
        Scanner reader = new Scanner(System.in);
        int year_in = reader.nextInt();
        int month_in = reader.nextInt();
        int day_in = reader.nextInt();
        int ans = 0;
        int month_2 = 28;
        if(year_in%400==0||year_in%4==0&&year_in%100!=0){
            month_2 = 29;
        }
        for (int i = 1; i < month_in; i++) {
            if(i == 2){
                ans += month_2;
            }
            for (int j = 0; j < month_30.length; j++) {
                if(i == month_30[j]){
                    ans += 30;
                    break;
                }
            }
            for (int j = 0; j < month_31.length; j++) {
                if(i == month_31[j]){
                    ans += 31;
                    break;
                }
            }
        }
        ans += day_in;
        System.out.println(ans);
    }
}
